package yang.cn.com.greendaoapp.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;

import yang.cn.com.greendaoapp.adapter.ExpandableItemAdapter;
import yang.cn.com.greendaoapp.adapter.MultipleItem;

/**
 * Created by Administrator on 2017/5/27.
 */
@Entity
public class FileInfo implements MultiItemEntity, Parcelable {
    @Id(autoincrement = true)
    private Long id;
    String fileName;
    String filePath;
    long fileSize;
    public boolean isDirectory;
    String suffix;
    String time;
    boolean isCheck = false;
    public boolean isPhoto = false;
    @Generated(hash = 244022209)
    public FileInfo(Long id, String fileName, String filePath, long fileSize,
            boolean isDirectory, String suffix, String time, boolean isCheck,
            boolean isPhoto) {
        this.id = id;
        this.fileName = fileName;
        this.filePath = filePath;
        this.fileSize = fileSize;
        this.isDirectory = isDirectory;
        this.suffix = suffix;
        this.time = time;
        this.isCheck = isCheck;
        this.isPhoto = isPhoto;
    }
    @Generated(hash = 1367591352)
    public FileInfo() {
    }

    protected FileInfo(Parcel in) {
        fileName = in.readString();
        filePath = in.readString();
        fileSize = in.readLong();
        isDirectory = in.readByte() != 0;
        suffix = in.readString();
        time = in.readString();
        isCheck = in.readByte() != 0;
        isPhoto = in.readByte() != 0;
    }

    public static final Creator<FileInfo> CREATOR = new Creator<FileInfo>() {
        @Override
        public FileInfo createFromParcel(Parcel in) {
            return new FileInfo(in);
        }

        @Override
        public FileInfo[] newArray(int size) {
            return new FileInfo[size];
        }
    };

    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getFileName() {
        return this.fileName;
    }
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
    public String getFilePath() {
        return this.filePath;
    }
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }
    public long getFileSize() {
        return this.fileSize;
    }
    public void setFileSize(long fileSize) {
        this.fileSize = fileSize;
    }
    public boolean getIsDirectory() {
        return this.isDirectory;
    }
    public void setIsDirectory(boolean isDirectory) {
        this.isDirectory = isDirectory;
    }
    public String getSuffix() {
        return this.suffix;
    }
    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }
    public String getTime() {
        return this.time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public boolean getIsCheck() {
        return this.isCheck;
    }
    public void setIsCheck(boolean isCheck) {
        this.isCheck = isCheck;
    }
    public boolean getIsPhoto() {
        return this.isPhoto;
    }
    public void setIsPhoto(boolean isPhoto) {
        this.isPhoto = isPhoto;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {

        parcel.writeString(fileName);
        parcel.writeString(filePath);
        parcel.writeLong(fileSize);
        parcel.writeByte((byte) (isDirectory ? 1 : 0));
        parcel.writeString(suffix);
        parcel.writeString(time);
        parcel.writeByte((byte) (isCheck ? 1 : 0));
        parcel.writeByte((byte) (isPhoto ? 1 : 0));
    }

    @Override
    public int getItemType() {
        return ExpandableItemAdapter.CONTENT;
    }
}
